package com.qiaofang.common.utils;

import lombok.Data;

import java.util.Objects;

@Data
public class Token {

    private Long userId;

    private String userUuid;

    private Long loginTime;

    private String uuid;

    public Token(Long userId, String userUuid, Long loginTime, String uuid) {
        this.userId = userId;
        this.userUuid = userUuid;
        this.loginTime = loginTime;
        this.uuid = uuid;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Token token = (Token) o;
        return Objects.equals(userUuid, token.userUuid) &&
                Objects.equals(uuid, token.uuid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userUuid, uuid);
    }

    @Override
    public String toString() {
        return userUuid + "." + uuid;
    }
}
